package leetcodev1.字符串;

public class LeetCode168 {

    //26进位
    public String convertToTitle(int columnNumber) {
        StringBuilder reverseRet = new StringBuilder();
        while (columnNumber != 0) {
            int currentVal = columnNumber % 26 == 0 ? 26 : columnNumber % 26;
            reverseRet.append((char) ('A' + currentVal - 1));
            columnNumber = (columnNumber - currentVal) / 26;//需要减去已计算的位
        }
        return reverseRet.reverse().toString();
    }
}
